package com.smasher.backup.dialog.select.model

import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider

class TargetViewModelFactory<S : Any>(private val backend: TargetBackendService) :
    ViewModelProvider.Factory {

    override fun <T : ViewModel> create(modelClass: Class<T>): T {
        if (modelClass.isAssignableFrom(TargetPagingViewModel::class.java)) {
            @Suppress("UNCHECKED_CAST")
            return TargetPagingViewModel<S>(backend) as T
        }
        return super.create(modelClass)
    }
}